﻿
Imports Entidades
Imports System.Data.Odbc
Imports System.Data.OleDb

Public Class SistemaDatos
    Public cn As OdbcConnection
    Public conectarme As New OleDbConnection
    Public Sub New()
        cn = New OdbcConnection("UID=liceoiep_sexto" & _
    ";PWD=pruebasexto123" & _
    ";DATABASE=liceoiep_sexto" & _
    ";SERVER=liceoiep.edu.uy" & _
    ";DRIVER={MySQL ODBC 5.2 Driver};")
   
    End Sub
    Public Sub agregar(cliente As Cliente)
        Dim comando As OdbcCommand
        comando = New OdbcCommand("Alta_Cliente", cn)
        comando.Parameters.AddWithValue("nom", cliente.nombre)
        comando.Parameters.AddWithValue("ape", cliente.apellido)
        comando.Parameters.AddWithValue("direc", cliente.direccion)
        Dim i As Integer
        cn.Open()

        For i = 0 To 3
            If cliente.cantidadtelefonos > i Then
                comando.Parameters.AddWithValue("tel" & i.ToString(), cliente.obtenertelefono(i))
            Else

                comando.Parameters.AddWithValue("tel" & i.ToString(), "")

            End If



        Next

        comando.ExecuteNonQuery()
        cn.Close()

    End Sub

End Class
